﻿using System;
using System.Web.UI.WebControls;
using Ones.ServiceNewsManagement;
using System.Web.UI;
using System.Text;

namespace Ones.Editorial.Writer
{
    public partial class NewsDisplay : System.Web.UI.Page
    {
        private ServiceNewsManagement.ServiceNewsManagementClient srvNewsMngmt=null;

        #region Events
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                srvNewsMngmt = new ServiceNewsManagementClient();

                rptNewsList.DataSource = srvNewsMngmt.getAllFilterNews(false);
                rptNewsList.DataBind();
            }
        }

        protected void LinkButton_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            Session["newsId"] = e.CommandArgument.ToString();

            switch (e.CommandName.ToString())
            {
                case "WEditNews":
                    Response.Redirect("~/Editorial/Writer/WNewsEdit.aspx");
                    break;
                case "WDeleteNews":
                    //string messageContent = string.Format("Are you sure you want to delete the {0} news?", Session["newsId"]);
                    //ClientScript.RegisterStartupScript(this.GetType(), "Alert", messageContent);
                    break;
            }
        }

        #endregion

        #region Methods

        #endregion
    }
}